from django.db import models
from django.contrib.auth import get_user_model

User = get_user_model()


class Question(models.Model):
    content = models.CharField(max_length=1024, verbose_name="问题内容")
    answer = models.CharField(max_length=1024, null=True, blank=True, verbose_name="问题解答")
    datetime = models.DateTimeField(auto_now=True, verbose_name="提问时间")
    asked_by = models.ForeignKey(User, on_delete=models.PROTECT, related_name="asked_user", verbose_name="提问学生")
    rejected_by = models.ForeignKey(User, on_delete=models.PROTECT, null=True, related_name="rejected_user", verbose_name="被拒管理员")
    audited_by = models.ForeignKey(User, on_delete=models.PROTECT, null=True, related_name="audited_user", verbose_name="审核管理员")
    answered_by = models.ForeignKey(User, on_delete=models.PROTECT, related_name="answered_user", verbose_name="解答研究员")
